<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <title>首页</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<div  id="content">
            <section class="content-header">
                <h1>
                    <i class="fa fa-envelope"></i>
                    <strong>信息分配</strong>
                </h1>
                <ol class="breadcrumb">
                    <li><a href="#"><i class="fa fa-home "></i>Home</a></li>
                    <li>信息管理</li>
                    <li class="active">信息分配</li>
                </ol>
            </section>
            <!-- Main content -->
            <section class="content">
                <div class="row">
                    <div class="col-md-12">
                        <div class="box box-info">
                            <div class="box-header with-border">
                                <i class="fa fa-th-list"></i>
                                <h4 class="box-title">销售信息查询</h4>
                            </div>
                            <div class="box-body">
                                <div class="form-inline">
                                	<div class="input-group">
										<input type="text" class="form-control" id="keyword"  placeholder="Search..." />
										<span class="input-group-btn">
											<button type="button" id="search-btn" class="btn btn-info searchBtn">查询</button>
                                            <button type="button" id="reset-btn" class="btn btn-info cancelBtn">撤消</button>
										</span>
									</div>
									<div class="input-group">
									<form action="" method="get">
										<span class="form-control" style="margin-left:20px">处理状态</span>
										<span class="form-control" style="margin-left:20px">
											<label><input name="isReceived" type="radio" value="" />全部 </label> 
											<label><input name="isReceived" type="radio" value="0" checked="checked"/>未处理 </label> 
											<label><input name="isReceived" type="radio" value="1" />已处理</label> 
										</span>
										<span class="form-control" style="margin-left:20px">信息类型</span>
										<span class="form-control" style="margin-left:20px">
											<label><input name="targetType" type="radio" value="2" checked="checked"/>传递信息</label> 
											<label><input name="targetType" type="radio" value="0" />本部信息</label> 
											<label><input name="targetType" type="radio" value="1" />协作信息</label> 
											<label><input name="targetType" type="radio" value="4" />全部 </label> 
										</span>
											 
											
									</form>
									</div>
									<button type="button" class="btn btn-info pull-right close-btn">关闭信息</button>
									<button type="button" class="btn btn-info pull-right detail-btn">查看详情</button>
									<button type="button" class="btn btn-info pull-right coop-btn">发起协作</button>
									<button type="button" class="btn btn-info pull-right del-btn">传递片区</button>
								</div>
                            </div>
                            <div class="box box-body" style="width:100%;overflow-x:scroll;">
                                <table id="chanceDeliveryTable" class="mytable dataTable table-bordered text-center table-striped table-hover" cellspacing="0" width="3500px">
                                    <thead>
                                        <tr>
                                            <th width="2%">序号</th>
                                            <th width="2%"><input type="checkbox" id="checkAll"/></th>
                							<th width="3%">信息状态</th>
                							<th width="7%">信息名称</th>
                							<th width="3%">信息优先级</th>
                							<th width="3%">信息来源</th>
               								<th width="5%">信息来源单位</th>
               								<th width="3%">所属行业</th>
               								<th width="3%">创建人</th>
               								<th width="4%">创建人片区</th>
                							<th width="5%">提供信息人资料</th>
                							<th width="9%">项目动态</th>
                							<th width="12%">设备情况</th>
                							<th width="5%">信息提供方影响力</th>
                							<th width="5%">预计订货量</th>
               								<th width="5%">订货单位</th>
                							<th width="4%">订货联系人</th>
                							<th width="5%">联系方式</th>
                							<th width="5%">订货单位地址</th>
                							<th width="4%">创建时间</th>
                							<th width="5%">关闭原因</th>	
                                        </tr>
                                    </thead>
                                    <tbody>
                                	
               						</tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
    <!--信息片区传递弹窗-->
    <div class="modal" id="chanceDeliveryModal">
        <div class="modal-dialog" role="dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title"><strong>请选择片区</strong></h4>
                    </div>
                    <div class="modal-body">
                    <div class="form-horizontal">
                    <div class="form-group">
                                <input type="hidden" name="id1" id="id1"/>
                                <input type="hidden" name="tempId" id="tempId"/>
                                <input type="hidden" name="targetType" id="targetType"/>
                                <input type="hidden" name="chanceName" id="chanceName"/>
                                <input type="hidden" name="userSuperior" id="userSuperior" th:value="${userSuperior}"/>
                                <label class="col-sm-2 control-label">分配片区</label>
                                <div class="col-sm-4">
                                    <div class="col-md-11">
                                        <select class="form-control"  type="text" name="mainArea"  id="mainArea">
                                        <option></option>
                                        <option th:each="saleArea:${saleAreas}"
								           th:if="${saleArea.superior == userSuperior}"	
								           th:value="${saleArea.id}"						
								           th:text="${saleArea.areaName}">
	                                    </option>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-sm-1">
                                <button type="button" class="btn btn-primary deliveryBtn" >分配</button>
                                </div>
                                <div id="cooperate1">
                                <label class="col-sm-3 control-label">是否传递信息</label>
                                <div class="col-sm-2">
                                    <div class="col-md-11">
                                        <input type="checkbox" id="isTransmit" value="1"/>
                                    </div>
                                </div>
                                </div>
                            </div>
                            <div class="form-group" id="cooperate2">
                            <label class="col-sm-2 control-label">传递部门</label>
                                <div class="col-sm-4">
                                    <div class="col-md-11">
                                        <select class="form-control"  type="text" name="transUnit"  id="transUnit" disabled="disabled">
                                        <option></option>
                                        <option th:each="superior:${superiors}"
								           th:if="${superior.title != userSuperior}"	
								           th:text="${superior.title}">
	                                    </option>
                                        </select>                                     
                                    </div>
                                </div>
                                <div class="col-sm-1">
                                <button type="button" class="btn btn-primary transBtn hide" >传递</button>
                                </div>
                            <label class="col-sm-2 control-label"></label>
                                <div class="col-sm-3">
                                  <div class="col-md-11">
                                  <p><font color="#FF0000"><strong id="info"></strong></font></p>
                                  </div>
                                </div>
                                
                            </div>
                            <div class="form-group">
                            <label class="col-sm-2 control-label">已分配片区</label>
                             <div class="col-sm-4">
                                  <div class="col-md-11">
                                  </div>
                                </div>
                                <label class="col-sm-2 control-label"></label>
                             <div class="col-sm-4">
                                  <div class="col-md-11">
                                  <button type="button" class="btn btn-info pull-right deleteDelivery">删除</button>
                                  </div>
                                </div>
                            </div>
                            <table id="chanceDeliveryModuleTable" class="mytable dataTable table-bordered text-center table-striped table-hover" cellspacing="0" width="100%">
                                    <thead>
                                        <tr>
                                            <th width="10%"><input type="checkbox" id="checkArea"/></th>
                                            <th width="30%">接收状态</th>
                							<th width="30%">上级部门</th>
                							<th width="30%">片区名称</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                	
               						</tbody>
                                </table>
					</div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">返回</button>
                    </div>
                </div>
                </div>
        </div>
    </div>
    <!--发起协作弹窗-->
        <div class="modal" id="distributeModal">
        <div class="modal-dialog" role="dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title"><strong>请选择协作部门</strong></h4>
                    </div>
                    <div class="modal-body">
                    <div class="form-horizontal">
                    <div class="form-group">
                    <input type="hidden" name="id2" id="id2"/>
							 <label class="col-sm-2 control-label">部门</label>
							 <div class="col-sm-4">
								 <div class="col-md-11">
								 <select class="form-control" name="coopSuperior"  id="coopSuperior"  datatype="*,*1-100"  onchange="gradeChange()">
								 <option></option>
								 <option th:each="superior:${superiors}"
								           th:if="${superior.title != userSuperior}"	
								           th:text="${superior.title}">
	                             </option>
								 </select>
								 </div>
								
							 </div>
							 <div class="col-sm-2"><button type="button" class="btn btn-primary coopBtn" >发起</button></div>
							 </div>
                            <div class="form-group">
                            <label class="col-sm-2 control-label">已协作部门</label>
                             <div class="col-sm-4">
                                  <div class="col-md-11">
                                  </div>
                                </div>
                                <label class="col-sm-2 control-label"></label>
                             <div class="col-sm-4">
                                  <div class="col-md-11">
                                  <button type="button" class="btn btn-info pull-right deleteCoop">删除</button>
                                  </div>
                                </div>
                            </div>
                            <table id="distributeModuleTable" class="mytable dataTable table-bordered text-center table-striped table-hover" cellspacing="0" width="100%">
                                    <thead>
                                        <tr>
                                            <th width="10%"><input type="checkbox" id="checkSuperior"/></th>
                                            <th width="45%">接收状态</th>
                							<th width="45%">部门</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                	
               						</tbody>
                                </table>
					</div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">返回</button>
                        
                    </div>
                </div>
                </div>
        </div>
    </div>
        <!--关闭机会弹窗-->
    <div class="modal" id="closeChanceModal">
        <div class="modal-dialog" role="dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title"><strong>关闭信息原因填写</strong></h4>
                    </div>
					<div class="box-body">
					<div class="form-horizontal">
					<div class="form-group">
							 <label class="col-sm-2 control-label">信息结果</label>
							 <div class="col-sm-4">
								 <div class="col-md-11">
								 <select  class="form-control" name="isSucceed"  id="isSucceed"  datatype="*,*1-100" >
								 <option>成功</option>
								 <option>失败</option>
								 <option>其他</option>
								 </select>
								 </div>
							 </div>
                             
							 <!-- <button type="button" class="btn btn-primary closeBtn" >选择</button> -->
							 
							 </div>
							  <div class="form-group">
							  	<label class="col-sm-2 control-label">合同号</label>
							  <div class="col-sm-4"> 
							<!--  <div class="col-sd-4 input-group" > -->
								 <div class="col-md-11">
								 <input  class="form-control" id="contractId" name="contractId" type="hidden"/>
								 <input class="form-control" name="contractCode" id="contractCode" readonly="readonly"/>
								 </div>
							 </div>
							 	<!-- <span class="input-group-btn">
									<button type="button" id="queryCustomer" class="btn btn-info" title="引入订货单位信息">
										<i class="fa fa-search"></i>
									</button>
								</span> -->
								<button type="button" class="btn btn-info addReplacementBtn" id="choose" >选择</button>
							  </div>
							 <div class="form-group">
							 <label class="col-sm-2 control-label">时间</label>
							 <div class="col-sm-4">
								 <div class="col-md-11">
								 <input class="form-control" id="finishDate" name="finishDate" disabled="disabled"/>
								 </div>
							 </div>
                             <label class="col-sm-2 control-label"></label>
							 <div class="col-sm-4">
								 <div class="col-md-11">
								 </div>
							 </div>
							 </div>
							 <div class="form-group">
					    <input type="hidden" name="id3" id="id3"/>			
                        <label class="col-sm-2 control-label">原因</label>
                                <div class="col-sm-10">
                                    <div class="col-md-12">
                                        <textarea class="form-control" rows="3" name="reason" id="reason" datatype="*1-100" style="resize: none;"></textarea>
                                    </div>
                                </div>
                                </div>
                                </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">返回</button>
                        <button type="button" class="btn btn-primary closeBtn" >保存</button>
                    </div>
                </div>
        </div>
    </div>
    <!-- 引入合同号弹窗 -->
    <div class="modal" id="modal-find-auditor">
			<div class="modal-dialog" role="dialog" style="width: 60%">
				<form id="form-find-user">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"
									aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>
							<h4 class="modal-title">
								<strong>合同号引入</strong>
							</h4>
						</div>
						<div class="modal-body">
							<div class="form-horizontal">
								<div class="box-body">
									<div class="form-inline">
										<div class="input-group">
											<input type="text" class="form-control" id="searchcontract"
												   placeholder="Search..." /> <span class="input-group-btn">
													<button type="button" id="btn-searchcontract"
															class="btn btn-info app-btn-search">查询</button>
													<button type="button" id="btn-reset"
															class="btn btn-info app-btn-reset">撤消</button>
												</span>
										</div>
									</div>
								</div>
								<div class="box box-body">
									<table id="table-usera"
										   class="mytable dataTable table-bordered text-center table-striped table-hover"
										   cellspacing="0" width="100%" align="center">
										<thead>
										<tr>
											<th width="10%">序号</th>
											<th width="10%">选择</th>
											<th width="20%">合同号</th>
											<th width="20%">合同类型</th>
											<th width="20%">状态</th>
											<th width="20%">总价</th>
											
										</tr>
										</thead>
										<tbody>
	
										</tbody>
									</table>
								</div>
							</div>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-info" id="btn-reference">引入</button>
							<button type="button"
									class="btn btn-default app-find-user-return"
									data-dismiss="modal">返回</button>
						</div>
					</div>
				</form>
			</div>
		</div>
    <script th:src="@{/chanceDelivery/chanceDeliveryindex.js}"></script>
    <script type="text/javascript">
    var oBox= document.getElementById('isTransmit');
    oBox.onclick =function(){
       if(this.checked){
          $("#mainArea").attr("disabled","disabled");
          $("#transUnit").removeAttr("disabled");
          $(".deliveryBtn").addClass("hide");
          $(".transBtn").removeClass("hide");
     } else{
    	 $("#mainArea").removeAttr("disabled");
         $("#transUnit").attr("disabled","disabled");
         $(".transBtn").addClass("hide");
         $(".deliveryBtn").removeClass("hide");
         }
     };
     
    </script>
    	  <script type="text/javascript">
	    function gradeChange(){
	        var objS = document.getElementById("coopSuperior");
	        var option = objS.options[objS.selectedIndex].text;
	        if(option == "销售处"){
	        	$("#areaName").removeAttr("style");
	        	$("#areaName1").attr("style","display:none");
	        	$("#areaName2").attr("style","display:none");
	        	$("#areaName3").attr("style","display:none");
	        	}
	        if(option == "成套处"){
	        	$("#areaName").attr("style","display:none");
	        	$("#areaName1").removeAttr("style");
	        	$("#areaName2").attr("style","display:none");
	        	$("#areaName3").attr("style","display:none");
	            }
	        if(option == "外贸处"){
	        	$("#areaName").attr("style","display:none");
	        	$("#areaName1").attr("style","display:none");
	        	$("#areaName2").removeAttr("style");
	        	$("#areaName3").attr("style","display:none");
	            }
	        if(option == "售后服务处"){
	        	$("#areaName").attr("style","display:none");
	        	$("#areaName1").attr("style","display:none");
	        	$("#areaName2").attr("style","display:none");
	        	$("#areaName3").removeAttr("style");
	        }
	       }
	  </script>
    </div>
</body>
</html>